home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / win_nt95 / cm95-10.zip / JOEBOB.TS < prev    next >
Text File  |  1996-10-29  |  6KB  |  212 lines

  1. ;****************************************************************************
  2. ; ClockMan95 Automation Assistant support file - TAPCIS script
  3. ; (c) 1995 Graphical Dynamics, Inc. The "Common helper functions" are placed
  4. ; in the public domain; otherwise permission is granted to use/modify this
  5. ; script file as long as it's not for resale.
  6. ;
  7. ; Written by: Jennifer Palonus
  8. ;
  9. ; Date    Who   Major changes
  10. ;-------  ---   -------------------------------------------------------------
  11. ;22nov95  jlp   Created.
  12. ;22nov95
  13. ;****************************************************************************
  14.  
  15. [*About this script*]
  16. Gets Joe Bob Briggs' latest horror flick review!
  17. This article is updated every Monday.
  18.  
  19. [*Script Setup*]
  20. Title=Joe Bob Briggs
  21.  
  22. ;****************************************************************************
  23. ; Main processing section.
  24. ;****************************************************************************
  25.  
  26. [*MenuItems*]
  27. text=Joe Bob Briggs
  28. item=1
  29.  
  30.  
  31. [Begin]
  32.     set @Timeout# 120
  33.     let ServiceName$    = "CIS:SYN-23"
  34.     let ServiceHasHdr    = @FALSE
  35.     let SubjectLine$    = "Joe Bob Briggs"
  36.     let Prompt$            = "^J!"
  37.     gosub "GoService"
  38.     if (OK = @FALSE) fail
  39.  
  40.     ForEach in MenuItems[] gosub "HandleMenu"
  41.     if (HMTFound = @FALSE) end
  42.  
  43.     gosub "CaptureMsg"
  44.     end
  45.  
  46.  
  47. ;****************************************************************************
  48. ; Common helper functions. (These are placed in the "public domain" by GDI.)
  49. ;****************************************************************************
  50. ; [GoService]
  51. ;
  52. ; Carries out a GO command & passes over the introductory text (if any).
  53. ; When this returns, you're ready to capture or parse the service's top menu.
  54. ;
  55. ; ServiceName$        The CIS service you want to GO to.
  56. ; ServiceHasHdr        Does this service have an intro paragraph ending with a
  57. ;                    "MORE !" prompt?
  58. ;****************************************************************************
  59. [GoService]
  60.     let OK = @TRUE
  61.     send "GO " ServiceName$
  62.  
  63.     if (ServiceHasHdr = @FALSE) return
  64.     let Prompt$ = "^JMORE !"         
  65.     gosub "WaitForPrompt"
  66.     send ""
  67.     return
  68.  
  69.     
  70. ;****************************************************************************
  71. ; [HandleMenu]
  72. ;
  73. ; Traverses the tree of menus until you're ready to capture a particular
  74. ; article. To call this function, declare an array section (ex.: [*Menus*])
  75. ; with menu item text and/or item numbers to look for, in either of these forms:
  76. ;     text=<text in menu item>
  77. ;     item=<menu item's number>
  78. ;     
  79. ; Then, call this function in a ForEach stmt: ForEach in Menus[] gosub "HandleMenu"
  80. ;
  81. ; SubjectLine$        The generated mail message's subject line.
  82. ; Prompt$            The prompt that ends the article. Usu. "^J!".
  83. ;
  84. ; Upon return, OK is @TRUE or @FALSE depending on whether any matching items
  85. ; were found. If @TRUE then you're ready to capture the selected article or
  86. ; parse the submenu.
  87. ;****************************************************************************
  88. [HandleMenu]
  89.     let HMTFound = @FALSE
  90.     ;Dispatch to HMText or HMItem, depending on how to choose menu item (by
  91.     ;"Text" or menu "Item" #)...
  92.     goto "HM" @arrItem$
  93.     ;else bad menu cmd...
  94.          Echo "Unrecognized menu item search type '" @arrItem$ "' in [HandleMenu]"
  95.         fail
  96.  
  97. [HMText]
  98.     let HMSearchText$ = @arrValue$
  99.  
  100. ;1 or more menu sections. If >1, they're separated by "MORE !" prompts...
  101. [HMTLoop]
  102.     waitlist
  103.         1 = "^JMORE !"
  104.         2 = "^J!"
  105.     endlist
  106.     DoWaitMenu TheMenuLines[]
  107.     if (@waitMatch# = 0) goto "HMTNoMatchTimeout"
  108.  
  109.     ForEach in TheMenuLines[] gosub "HMTSelectItem"
  110.     if (HMTFound = @TRUE) return
  111.  
  112. [HMTNoMatch]
  113.     if (@waitMatch# = 1) goto "HMTNoMatchMore"
  114.     if (@waitMatch# = 2) goto "HMTNoMatchEOM"
  115.  
  116. [HMTNoMatchTimeout]
  117.     Echo "Timed out waiting for full menu"
  118.     fail
  119.  
  120. [HMTNoMatchMore]
  121.     send ""
  122.     goto "HMTLoop"
  123.  
  124. [HMTNoMatchEOM]
  125.     return
  126.  
  127.  
  128. [HMTSelectItem]
  129.     if (HMTFound = @TRUE) return
  130.  
  131.     if (@strstr (@arrValue$, HMSearchText$) = @FALSE) return
  132.     let HMTFound = @TRUE
  133.     Echo "We found '" HMSearchText$ "': #" @arrItem$ " = '" @arrValue$ "'!"
  134.     
  135.     send @arrItem$
  136.     return
  137.  
  138.  
  139. [HMItem]
  140.     let HMTFound = @TRUE
  141.     let Prompt$ = ""
  142.     gosub "WaitForPrompt"
  143.  
  144.     Echo "Selecting item #" @arrValue$
  145.     send @arrValue$
  146.     return
  147.  
  148.     
  149. ;****************************************************************************
  150. ; [CaptureMsg]
  151. ;
  152. ; Assuming CIS is about to send us the text that we want to place into a mail
  153. ; message, this routine captures the text 'till we get a <CR> & ! prompt.
  154. ;
  155. ; SubjectLine$        The custom subject line if different than the default.
  156. ; Prompt$            The prompt that ends the article. Usu. "^J!".
  157. ;****************************************************************************
  158. [CaptureMsg]
  159.     if (@capName$ = "") let @capName$ = @pathMsg$ @svcName$ '.MSG'
  160.     let @hdrSub$ = SubjectLine$
  161.     Echo "Capturing article to " @capName$
  162.     CapHeader
  163.  
  164.     let OK = @TRUE
  165.  
  166.     let Prompt$ = "^J!"
  167.     gosub "WaitForPrompt"
  168.     CapClose
  169.  
  170.     let SubjectLine$ = ""
  171.     return
  172.  
  173.  
  174. ;****************************************************************************
  175. ; [WaitForPrompt]
  176. ;
  177. ; Wait till the end of a menu or opening text. This routine handles menus
  178. ; split up into multiple chunks, each of which end in "MORE !" prompts.
  179. ; If you DO want to wait for "MORE !", then set Prompt$ to it.
  180. ;
  181. ; Prompt$            The prompt you're waiting for. Usu. "^J!".
  182. ;****************************************************************************
  183. [WaitForPrompt]
  184.     let OK = @TRUE
  185.     if (Prompt$ = "") let Prompt$ = "^J!"
  186.  
  187. [WFPLoop]
  188.     waitlist
  189.         1 = Prompt$
  190.         2 = "^JMORE !"
  191.         3 = "^J!"
  192.     endlist
  193.     DoWaitMenu TheMenuLines[]
  194.     if (@waitMatch# = 1) return
  195.     if (@waitMatch# = 2) goto "WFPMore"
  196.     if (@waitMatch# = 3) return
  197.  
  198.     ; else...
  199.     let OK = @FALSE
  200.     Echo "...timed out waiting for a prompt"
  201.     return
  202.  
  203. [WFPMore]
  204.     Send ""
  205.     goto "WFPLoop"
  206.  
  207.  
  208. ;****************************************************************************
  209. [HandleErrors]
  210.     fail
  211.  
  212.